#[doc = "Register `UART_DR` reader"]
pub struct R(crate::R<UART_DR_SPEC>);
impl core::ops::Deref for R {
    type Target = crate::R<UART_DR_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl core::convert::From<crate::R<UART_DR_SPEC>> for R {
    fn from(reader: crate::R<UART_DR_SPEC>) -> Self {
        R(reader)
    }
}
#[doc = "Register `UART_DR` writer"]
pub struct W(crate::W<UART_DR_SPEC>);
impl core::ops::Deref for W {
    type Target = crate::W<UART_DR_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl core::ops::DerefMut for W {
    #[inline(always)]
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl core::convert::From<crate::W<UART_DR_SPEC>> for W {
    fn from(writer: crate::W<UART_DR_SPEC>) -> Self {
        W(writer)
    }
}
#[doc = "Overflow error status.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum OE_A {
    #[doc = "0: No overflow error occurs."]
    NO_ERROR = 0,
    #[doc = "1: An overflow error occurs."]
    HAS_ERROR = 1,
}
impl From<OE_A> for bool {
    #[inline(always)]
    fn from(variant: OE_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `oe` reader - Overflow error status."]
pub struct OE_R(crate::FieldReader<bool, OE_A>);
impl OE_R {
    pub(crate) fn new(bits: bool) -> Self {
        OE_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> OE_A {
        match self.bits {
            false => OE_A::NO_ERROR,
            true => OE_A::HAS_ERROR,
        }
    }
    #[doc = "Checks if the value of the field is `NO_ERROR`"]
    #[inline(always)]
    pub fn is_no_error(&self) -> bool {
        **self == OE_A::NO_ERROR
    }
    #[doc = "Checks if the value of the field is `HAS_ERROR`"]
    #[inline(always)]
    pub fn is_has_error(&self) -> bool {
        **self == OE_A::HAS_ERROR
    }
}
impl core::ops::Deref for OE_R {
    type Target = crate::FieldReader<bool, OE_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Break error status.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum BE_A {
    #[doc = "0: No break error occurs."]
    NO_ERROR = 0,
    #[doc = "1: A break error occurs."]
    HAS_ERROR = 1,
}
impl From<BE_A> for bool {
    #[inline(always)]
    fn from(variant: BE_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `be` reader - Break error status."]
pub struct BE_R(crate::FieldReader<bool, BE_A>);
impl BE_R {
    pub(crate) fn new(bits: bool) -> Self {
        BE_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> BE_A {
        match self.bits {
            false => BE_A::NO_ERROR,
            true => BE_A::HAS_ERROR,
        }
    }
    #[doc = "Checks if the value of the field is `NO_ERROR`"]
    #[inline(always)]
    pub fn is_no_error(&self) -> bool {
        **self == BE_A::NO_ERROR
    }
    #[doc = "Checks if the value of the field is `HAS_ERROR`"]
    #[inline(always)]
    pub fn is_has_error(&self) -> bool {
        **self == BE_A::HAS_ERROR
    }
}
impl core::ops::Deref for BE_R {
    type Target = crate::FieldReader<bool, BE_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Parity error status.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum PE_A {
    #[doc = "0: No parity error occurs."]
    NO_ERROR = 0,
    #[doc = "1: A parity error occurs."]
    HAS_ERROR = 1,
}
impl From<PE_A> for bool {
    #[inline(always)]
    fn from(variant: PE_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `pe` reader - Parity error status."]
pub struct PE_R(crate::FieldReader<bool, PE_A>);
impl PE_R {
    pub(crate) fn new(bits: bool) -> Self {
        PE_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> PE_A {
        match self.bits {
            false => PE_A::NO_ERROR,
            true => PE_A::HAS_ERROR,
        }
    }
    #[doc = "Checks if the value of the field is `NO_ERROR`"]
    #[inline(always)]
    pub fn is_no_error(&self) -> bool {
        **self == PE_A::NO_ERROR
    }
    #[doc = "Checks if the value of the field is `HAS_ERROR`"]
    #[inline(always)]
    pub fn is_has_error(&self) -> bool {
        **self == PE_A::HAS_ERROR
    }
}
impl core::ops::Deref for PE_R {
    type Target = crate::FieldReader<bool, PE_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Frame error status.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum FE_A {
    #[doc = "0: No frame error is detected."]
    NO_ERROR = 0,
    #[doc = "1: A frame error occurs."]
    HAS_ERROR = 1,
}
impl From<FE_A> for bool {
    #[inline(always)]
    fn from(variant: FE_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `fe` reader - Frame error status."]
pub struct FE_R(crate::FieldReader<bool, FE_A>);
impl FE_R {
    pub(crate) fn new(bits: bool) -> Self {
        FE_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> FE_A {
        match self.bits {
            false => FE_A::NO_ERROR,
            true => FE_A::HAS_ERROR,
        }
    }
    #[doc = "Checks if the value of the field is `NO_ERROR`"]
    #[inline(always)]
    pub fn is_no_error(&self) -> bool {
        **self == FE_A::NO_ERROR
    }
    #[doc = "Checks if the value of the field is `HAS_ERROR`"]
    #[inline(always)]
    pub fn is_has_error(&self) -> bool {
        **self == FE_A::HAS_ERROR
    }
}
impl core::ops::Deref for FE_R {
    type Target = crate::FieldReader<bool, FE_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `data` reader - Data to be transmitted and received."]
pub struct DATA_R(crate::FieldReader<u8, u8>);
impl DATA_R {
    pub(crate) fn new(bits: u8) -> Self {
        DATA_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for DATA_R {
    type Target = crate::FieldReader<u8, u8>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `data` writer - Data to be transmitted and received."]
pub struct DATA_W<'a> {
    w: &'a mut W,
}
impl<'a> DATA_W<'a> {
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub unsafe fn bits(self, value: u8) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0xff << 7)) | (((value as u16) & 0xff) << 7);
        self.w
    }
}
impl R {
    #[doc = "Bit 11 - Overflow error status."]
    #[inline(always)]
    pub fn oe(&self) -> OE_R {
        OE_R::new(((self.bits >> 11) & 0x01) != 0)
    }
    #[doc = "Bit 10 - Break error status."]
    #[inline(always)]
    pub fn be(&self) -> BE_R {
        BE_R::new(((self.bits >> 10) & 0x01) != 0)
    }
    #[doc = "Bit 9 - Parity error status."]
    #[inline(always)]
    pub fn pe(&self) -> PE_R {
        PE_R::new(((self.bits >> 9) & 0x01) != 0)
    }
    #[doc = "Bit 8 - Frame error status."]
    #[inline(always)]
    pub fn fe(&self) -> FE_R {
        FE_R::new(((self.bits >> 8) & 0x01) != 0)
    }
    #[doc = "Bits 7:14 - Data to be transmitted and received."]
    #[inline(always)]
    pub fn data(&self) -> DATA_R {
        DATA_R::new(((self.bits >> 7) & 0xff) as u8)
    }
}
impl W {
    #[doc = "Bits 7:14 - Data to be transmitted and received."]
    #[inline(always)]
    pub fn data(&mut self) -> DATA_W {
        DATA_W { w: self }
    }
    #[doc = "Writes raw bits to the register."]
    pub unsafe fn bits(&mut self, bits: u16) -> &mut Self {
        self.0.bits(bits);
        self
    }
}
#[doc = "UART_DR is the UART data register.\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [uart_dr](index.html) module"]
pub struct UART_DR_SPEC;
impl crate::RegisterSpec for UART_DR_SPEC {
    type Ux = u16;
}
#[doc = "`read()` method returns [uart_dr::R](R) reader structure"]
impl crate::Readable for UART_DR_SPEC {
    type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [uart_dr::W](W) writer structure"]
impl crate::Writable for UART_DR_SPEC {
    type Writer = W;
}
#[doc = "`reset()` method sets UART_DR to value 0"]
impl crate::Resettable for UART_DR_SPEC {
    #[inline(always)]
    fn reset_value() -> Self::Ux {
        0
    }
}
